package com.koi.classservice.handler;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.koi.classservice.domain.po.Course;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

// Excel 读取监听器
@Component
public class CourseExcelListener extends AnalysisEventListener<Course> {
    private List<Course> courses = new ArrayList<>();

    @Override
    public void invoke(Course course, AnalysisContext analysisContext) {
        courses.add(course);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        // 读取完成后的操作
    }

    public List<Course> getCourses() {
        return courses;
    }
}

